package com.lx.boot.db.domain;

import com.lx.annotation.Note;
import com.lx.boot.config.annotation.Properties;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "自定义数据源信息")
@Properties(prefix="server.db")
public class DataBaseProperties {

    @Note("是否开启自定义数据库")
    private boolean enable;

    @NotBlank(message = "数据库链接不能为空!")
    @Schema(description = "数据库链接(ip:prot 或者 jdbc:xxx...)")
    private String url;

    @NotBlank(message = "数据库登录名不能为空!")
    @Schema(description = "数据库登录名")
    private String username;

    @NotBlank(message = "数据库密码不能为空!")
    @Schema(description = "数据库密码")
    private String password;

    @Note("初始化sql,默认为mysql脚本")
    private String connectionInitSql = "SET NAMES utf8mb4";

}
